'use strict';

var menuItems = [
   	{
        id: 'weapon',
        title: '生产加工',
        icon: '#chilun',
        type:1,

    },
    {
        id   : 'run',
        title: '防伪查询',
        icon: '#glasses',
        type:2,
    },
    {
        id   : 'drive',
        title: '原料追溯',
        icon: '#jiegou',
        type:3,
    },
    {
        id   : 'figth',
        title: '检验入库',
        icon: '#jianyan',
        type:4,
    },
    {
        id   : 'more',
        title: '产品检测',
        icon: '#jiance',
     	type:5,
    }
    
];
window.alert = function(name){

    var iframe = document.createElement("IFRAME");
    iframe.style.display="none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    window.frames[0].window.alert(name);
    iframe.parentNode.removeChild(iframe);
};


window.confirm = function (message) {
    var iframe = document.createElement("IFRAME");
    iframe.style.display = "none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    var alertFrame = window.frames[0];
    var result = alertFrame.window.confirm(message);
    iframe.parentNode.removeChild(iframe);
    return result;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
window.onload = function () {
	var id=getQueryVariable("id")
	function getQueryVariable(variable){
	    var query =decodeURI(window.location.search.substring(1));
	    var vars = query.split("&");
	    for (var i=0;i<vars.length;i++) {
	       var pair = vars[i].split("=");
	       if(pair[0] == variable){return pair[1];}
	    }
	    return(false);
	}
    var svgMenu = new RadialMenu({
        parent      : document.body,
        size        : 750,
        closeOnClick: false,
        menuItems   : menuItems,
        onClick     : function (item) {
        	if(item.type==2){
                alert('功能完善ing...', function() {
                });
        		//window.location.href="decode.html?id="+id
        	}else{
        		window.location.href="desc.html?type="+item.type+'&id='+id
        	}
        	
            console.log('You have clicked:', item);
        }
    });
	svgMenu.open();     //初始化加载
	
	
	
    var openMenu = document.getElementById('openMenu');
    openMenu.onclick = function () {
    	//document.getElementById('openMenu').style.zIndex=0
        //svgMenu.open();
        
        window.location.href='desc.html?type=6&id='+id
        
    };

    /*var closeMenu = document.getElementById('closeMenu');
    closeMenu.onclick = function () {
  	
        svgMenu.close();
    };*/
};